home *** CD-ROM | disk | FTP | other *** search
/ Programming an RTS Game with Direct3D / Programming an RTS Game with Direct3D.iso / Examples / Chapter 4 / Example 4.2 / heightMap.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-06-29  |  797 b   |  38 lines

  1. #include <d3dx9.h>
  2. #include "intpoint.h"
  3.  
  4. struct PARTICLE{
  5.     D3DXVECTOR3 position;
  6.     D3DCOLOR color;
  7.     static const DWORD FVF;
  8. };
  9.  
  10. struct HEIGHTMAP
  11. {
  12.     //Functions
  13.     HEIGHTMAP(IDirect3DDevice9* Dev, INTPOINT _size);
  14.     ~HEIGHTMAP();
  15.     void Release();
  16.  
  17.     HRESULT LoadFromFile(char fileName[]);
  18.     HRESULT CreateRandomHeightMap(int seed, float noiseSize, float persistence, int octaves);
  19.  
  20.     HRESULT CreateParticles();
  21.     void Render();
  22.     D3DXVECTOR2 GetCentre(){return D3DXVECTOR2(m_size.x / 2.0f, m_size.y / 2.0f);}
  23.  
  24.     //variables
  25.     INTPOINT m_size;
  26.     float m_maxHeight;
  27.     float *m_pHeightMap;
  28.  
  29.     //Vertex buffer for points
  30.     IDirect3DVertexBuffer9 *m_pVb;
  31.  
  32.     //Our device
  33.     IDirect3DDevice9* m_pDevice; 
  34.  
  35.     //Sprite
  36.     ID3DXSprite *m_pSprite;
  37.     IDirect3DTexture9 *m_pHeightMapTexture;
  38. };